import React, { Component } from 'react';
import Taro from '@tarojs/taro';
import {View} from '@tarojs/components'

export default class Detail extends Component {
  UNSAFE_componentWillMount() {
    const params = Taro.getCurrentInstance().router.params
    let mpkey = ''
    const user = Taro.getStorageSync('user') || ''
    if (user && user.mpkey && user.mpkey !== 'undefined') {
      mpkey = user.mpkey
    }
    let url = '/common/hotel/detail'
    if (Object.keys(params).length > 0) {
      let text = '?'
      for (const key in params) {
        text += `${key}=${params[key]}&`
      }
      url += text
      if (mpkey) {
        url += '&mpkey=' + mpkey
      }
      Taro.redirectTo({url})
    } else {
      Taro.redirectTo({url: url + '?mpkey=' + mpkey})
    }
  }

  render() {
    return (
      <View />
    )
  }
}
